﻿@model WeProjectsModel.Project

@{
    ViewBag.Title = "Edit";
    int userId = int.Parse(Membership.GetUser().ProviderUserKey.ToString());
    @*不是组长，也不是管理员*@
    if(!Roles.IsUserInRole("sysadmin") && Model.OwnerID!=userId)
    {
        Response.Write("当前用户没有权限操作");
        Response.End();
    }
}
@Html.Partial("_projectMenu",Model.ID)
<h2>
    @Model.Title > 编辑项目
</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)    
    <table>
        <tr>
            <td>项目名称：</td><td><input type="hidden" name="id" value="@Html.ViewContext.RouteData.Values["id"]" />
            <input type="text" name="title" value="@Model.Title" /></td>
        </tr>
        <tr>
            <td>项目编号：</td><td><input type="text" name="serNum" value="@Model.SerialNumber" />
            <input type="hidden" name="owner" value="@userId" /></td>
        </tr>
        <tr>
            <td>项目描述：</td>
            <td>
                <input type="text" name="desc" value="@Model.Description" />
            </td>
        </tr>
        @*如果是子项目，则存在member*@
        <tr>
            <td>项目组组长：</td><td>
            <input type="text" name="memberName" value="@ViewBag.projectOwner" /> @ViewBag.memberErr
            </td>
        </tr>
    </table>
    <p>
            <input type="submit" value="提交" />
        </p>
    }  

<div>
    @Html.ActionLink("返回列表", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
